#####################################################################
# Product:      KnowledgeEngine (Plone Edition)
#
# File:         Assessible.py
#
# Copyright:    Copyright (c) 2004, Faulkner Technologies
#
# Author:       Brian Oliver
#
# Description:  The Assessible mix-in provides basic support 
#               for Components that have assessment state. For example:
#               TextBox, CheckBox, NumericBox.
#
#               Methods of this interface are used by the Assessment
#               and AssessmentStorageTool classes to manage the
#               storage of values for stateful components.
#
#               NOTE 1: Classes mixing in this implementation MUST
#               ensure that the corresponding ClassInfo for the said 
#               classes have their isInstanceOf methods modified
#               to return true for the 'Assessible' interface.
#
#               NOTE 2: This implementation is RADICALLY different
#               from the 0.x branch of the KnowledgeEngine, the 
#               primary difference being that component storage is
#               now storage agnostic.
#
# See Also:     Assessment, AssessmentStorageTool, 
#               AssessmentComponentState, AssessmentComponentValueTypes
#####################################################################

#####################################################################
## KnowledgeEngine Library Imports
# (none)

#####################################################################
## Zope Library Imports
# (none)
 
#####################################################################
## Python Library Imports
# (none)

#####################################################################
## Assessible Class Definition
class Assessible:
    """
        Defines storage meta information and processing functions
        to support a stateful component (during assessments)
    """

    #---------------------------------------------------------------#

    def __init__(self):
        """
            Constructor for the object
        """
        
        #this is a stateless mix-in
        pass
        
    #---------------------------------------------------------------#
        
    def getAssessmentValueType(self):
        """
            ABSTRACT: Returns the type of the value that is to be stored
            for this component when it's assessment state is persisted.
            
            NOTE 1: See AssessmentComponentValueTypes for a list of defined contants       
            NOTE 2: This method MUST be overriden in the implementing
            class to specify the correct type for value persistence
            
            RETURN TYPE: String
        """
        
        return None
        
    #---------------------------------------------------------------#
        
    def getDefaultAssessmentState(self, assessment):
        """
            ABSTRACT: Constructs and returns a suitable 'default' 
            AssessmentComponentState for the provided Assessment
            instance.

            NOTE: This method MUST be overriden in the implementing
            class to provide a suitable default value for the component
            
            RETURN TYPE: AssessmentComponentState
        """
        
        return None
            
    #---------------------------------------------------------------#

    def updateAssessmentState(self, assessment, formValue):
        """
            ABSTRACT: Updates the specified assessment using
            the provided HTTP REQUEST formValue.
            
            NOTE: This method MUST be overriden in the implementing
            class to suitably update the component state
        """
        
        pass
            
    #---------------------------------------------------------------#

#####################################################################
## Class Initialisation
# (none)
